#include <iostream>
#include <cmath>
#include <cstdlib>
#include <ctime>
using namespace std;
#include "gas_phase_2nd_order.h"

#define PI 3.1415

int main()
{
	// Test input #1: constant value with small random noize
	// Expect: the output is about around 0.1 with random noise
	/*gas_phase_2nd_order GasPhase1(0.5,0.9,2,850,133.32,10,0.01,0.01,0.05,"test1.dat");
	
	double RandDisturb;
	srand(time(NULL));
	for(int RepeatCount = 0;RepeatCount < 1;RepeatCount++)
	{
		RandDisturb = 0.00*rand()/RAND_MAX;
		GasPhase1.reset();
		while(GasPhase1.notfinish())
		{
			GasPhase1.update_explicit(1);
		}
	}*/

	// Test input #2: fast changing signal sin(2*pi/10*t)
	// Expect: Xs should be a sine wave with applitude equals to 0.5
	gas_phase_2nd_order GasPhase2(0.5,0.9,2,850,133.32,10,0.01,0.01,0.0,"test2.dat");
	for(int RepeatCount = 0;RepeatCount < 10;RepeatCount++)
	{
		GasPhase2.reset();
		while(GasPhase2.notfinish())
		{
			GasPhase2.update_explicit(0.5+0.2*sin(50*PI*GasPhase2.time/10));
		}
	}
	
	// Test input #3: slow changing signal sin(2*pi/10*t)
	// 
	cout << "Test SUCCESS!\n";
	system("pause");
}